import Vue from 'vue'
import Router from 'vue-router'
//引入组件
import login from "../components/login"
import Home from '../components/Home.vue'
import welcome from '../components/welcome.vue'
import StudentList from '../components/student/StudentList.vue'
import StudentAdd from '../components/student/StudentAdd.vue'
import StudentDelete from '../components/student/StudentDelete.vue'
import StudentUpdate from '../components/student/StudentUpdate.vue'
import StudentFound from '../components/student/StudentFound.vue'
import StudentAge from '../components/student/StudentAge.vue'
import StudentRegion from '../components/student/StudentRegion.vue'
import StudentPolitics from '../components/student/StudentPolitics.vue'

Vue.use(Router)

export default new Router({
  routes: [
    {
     //如果访问的是/，进行重定向进入login页面中
     path: '/',
     redirect: '/login'
    },
    {
      //路由跳转路径
      path: '/login',
      //路由跳转组件
      component: login
    },
    {
      //路由跳转路径
      path: '/home',
      //路由跳转组件
      component: Home,
      redirect:"/welcome",
      children:[
        {path:"/welcome",component: welcome,},
        {path:"/list", component:StudentList},
        {path:"/add", component:StudentAdd},
        {path:"/delete", component:StudentDelete},
        {path:"/update", component:StudentUpdate},
        {path:"/find", component:StudentFound},
        {path:"/age", component:StudentAge},
        {path:"/region", component:StudentRegion},
        {path:"/politics", component:StudentPolitics},

      ]
    }
  ]
  
})
